<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改渠道商管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-channel-edit" th:object="${channel}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">推广员：</label>
                <div class="col-sm-8">
                    <select name="promoterId" id="promoter" class="form-control select2-multiple" required>
						<option th:each="user:${promoters}" th:value="${user.userId}" th:text="${user.userName}" th:field="*{promoterId}"></option>
					</select>
                </div>
            </div>
        	<div class="form-group">    
                <label class="col-sm-3 control-label">渠道商全称：</label>
                <div class="col-sm-8">
                    <input name="fullName" class="form-control" type="text" th:field="*{fullName}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道商简称：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" th:field="*{name}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道logo;示例 xxxxx.png：</label>
                <div class="col-sm-8">
                    <input name="logo" class="form-control" type="text" th:field="*{logo}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道商类型：</label>
                <div class="col-sm-8">
                    <select name="model" class="form-control"  required>
                			<div th:if="${@permission.isAnyRoles('ROLE_ADMIN,ROLE_SW,ROLE_SWZZ,ROLE_YHYY,ROLE_MQYW')}">
                				<option value="NORMAL" th:field="*{model}">普通</option>
                			</div>
								<option value="UNION" th:field="*{model}">联盟</option>
							<div th:if="${@permission.isAnyRoles('ROLE_ADMIN,ROLE_GH,ROLE_GHZZ')}" >
								<option value="GUILD" th:field="*{model}">公会</option>
								<option value="AGENT" th:field="*{model}">代理商</option>
								<option value="STUDIO" th:field="*{model}">工作室</option>
								<option value="ANCHOR" th:field="*{model}">主播</option>
								<option value="SITES" th:field="*{model}">网站</option>
								<option value="APP" th:field="*{model}">APP</option>
								<option value="WechatH5" th:field="*{model}">微信H5</option>
								<option value="OTHER" th:field="*{model}">其他</option>
		                    </div>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">创建子用户：</label>
                <div class="col-sm-8">
                   <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'subUser_' + dict.dictCode}" name="subUser" th:value="${dict.dictValue}" th:checked="${dict.default}">
                        <label th:for="${'subUser_' + dict.dictCode}" th:text="${dict.dictLabel}" th:field="*{subUser}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">字母缩写：</label>
                <div class="col-sm-8">
                    <input name="acronym" readonly="true" class="form-control numEngCheck" type="text" th:field="*{acronym}" required >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">渠道商帐号：</label>
                <div class="col-sm-8">
                    <input name="user.loginName" readonly="true" class="form-control" type="text" maxlength="30" th:field="*{user.loginName}" required>
                </div>
            </div>
            
            <!-- <div class="form-group">    
                <label class="col-sm-3 control-label">结算开始日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="settleStartDate" class="form-control" placeholder="yyyy-MM-dd" type="text" th:field="*{}>
                    </div>
                </div>
            </div> -->
            <div class="form-group">    
                <label class="col-sm-3 control-label">结算周期：</label>
                <div class="col-sm-8">
                    <select name="settlePeriod" class="form-control m-b" th:with="type=${@dict.getType('cwsk_settle_period')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{settlePeriod}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">结算方式：</label>
                <div class="col-sm-8">
                    <select name="settleType" class="form-control m-b" th:with="type=${@dict.getType('cwsk_settle_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{settleType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">税率：</label>
                <div class="col-sm-8">
                    <select name="taxRate" class="form-control m-b" th:with="type=${@dict.getType('cwsk_tax_rate')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{taxRate}"></option>
                    </select>
                </div>
            </div>
           	<div class="form-group">    
                <label class="col-sm-3 control-label">代缴税率：</label>
                <div class="col-sm-8">
                    <select name="replaceTaxRate" class="form-control m-b" th:with="type=${@dict.getType('cwsk_tax_rate')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{replaceTaxRate}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否代充：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'allowGeneration_' + dict.dictCode}" name="allowGeneration" th:value="${dict.dictValue}"  th:field="*{allowGeneration}">
                        <label th:for="${'allowGeneration_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看游戏收益统计：</label>
                <div class="col-sm-8">
                   <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'gameIncomestatPower_' + dict.dictCode}" name="gameIncomestatPower" th:value="${dict.dictValue}" th:field="*{gameIncomestatPower}">
                        <label th:for="${'gameIncomestatPower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看渠道收益统计：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'channelProfitpower_' + dict.dictCode}" name="channelProfitpower" th:value="${dict.dictValue}" th:field="*{channelProfitpower}">
                        <label th:for="${'channelProfitpower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看用户注册明细：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'registrationPower_' + dict.dictCode}" name="registrationPower" th:value="${dict.dictValue}" th:field="*{registrationPower}">
                        <label th:for="${'registrationPower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看充值明细：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'rechargePower_' + dict.dictCode}" name="rechargePower" th:value="${dict.dictValue}" th:field="*{rechargePower}">
                        <label th:for="${'rechargePower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看CPS用户注册明细：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'cpsRegistrationPower_' + dict.dictCode}" name="cpsRegistrationPower" th:value="${dict.dictValue}" th:field="*{cpsRegistrationPower}">
                        <label th:for="${'cpsRegistrationPower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看所属玩家信息：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'searchAscripUserPower_' + dict.dictCode}" name="searchAscripUserPower" th:value="${dict.dictValue}" th:field="*{searchAscripUserPower}">
                        <label th:for="${'searchAscripUserPower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">查看IOS充值明细：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cwsk_special_power')}">
                        <input type="radio" th:id="${'iosRechargePower_' + dict.dictCode}" name="iosRechargePower" th:value="${dict.dictValue}" th:field="*{iosRechargePower}">
                        <label th:for="${'iosRechargePower_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
             <div class="form-group">    
                <label class="col-sm-3 control-label">收款方户名：</label>
                <div class="col-sm-8">
                    <input name="accountName" class="form-control" type="text" th:field="*{accountName}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收款方开户行：</label>
                <div class="col-sm-8">
                    <input name="accountBank" class="form-control" type="text" th:field="*{accountBank}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收款方帐号：</label>
                <div class="col-sm-8">
                    <input name="accountNumber" class="form-control" type="text" th:field="*{accountNumber}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">联系人：</label>
                <div class="col-sm-8">
                    <input name="contact" class="form-control" type="text" th:field="*{contact}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">手机号：</label>
                <div class="col-sm-8">
                    <input name="mobile" class="form-control" type="text" th:field="*{mobile}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">QQ：</label>
                <div class="col-sm-8">
                    <input name="qq" class="form-control" type="text" th:field="*{qq}">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script type="text/javascript">
        var prefix = ctx + "cwsk/channel";
        $("#form-channel-edit").validate({
        	onkeyup: false,
        	rules:{
        		promoter:{required:true},
        		name:{
        			remote: {
                        url: prefix + "/checkNameUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	"id": function() {
                                return $("#id").val();
                            },
                        	"name": function() {
                                return $.common.trim($("#name").val());
                            }
                        },
                        dataFilter: function(data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
        		acronym:{
                    remote: {
                        url: prefix + "/checkAcronymUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	"id": function() {
                                return $("#id").val();
                            },
                            "acronym": function () {
                                return $.common.trim($("#acronym").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},  
        	},
        	messages: {
                "name": {
                    remote: "渠道简称已经存在"
                },
        		"acronym": {
                    remote: "字母缩写已经存在"
        		}   
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-channel-edit').serialize());
            }
        }

        $("input[name='settleStartDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>